<template>
    <view>
        <u-navbar :is-back="true" :title="navbar.title" :background="navbar.background">
        </u-navbar>
        <view class="u-page">
            <view class="wrap">
                <u-form label-width="150">
                                                    <u-form-item :label="$t('ureport.ureport.ureportId')" prop="ureportId">
                                    <u-input ref="ureportId" v-model="ureportInfo.ureportId" type="text"></u-input>
                                </u-form-item>
                                <u-form-item :label="$t('ureport.ureport.ureportName')" prop="ureportName">
                                    <u-input ref="ureportName" v-model="ureportInfo.ureportName" type="text"></u-input>
                                </u-form-item>
                                <u-form-item :label="$t('ureport.ureport.ureportPath')" prop="ureportPath">
                                    <u-input ref="ureportPath" v-model="ureportInfo.ureportPath" type="text"></u-input>
                                </u-form-item>
                </u-form>
                <u-button shape="circle" @click="saveOrUpdate">{{ $t('system.submit') }}</u-button>
            </view>
        </view>
        <footerBar></footerBar>
    </view>
</template>

<script>
    import request from "utils/request.js"
    import cascader from '@/components/yunmiao-cascader/yunmiao-cascader.vue';
    import ldSelect from '@/components/ld-select/ld-select.vue';
    import zMultiChoose from '@/components/z-multi-choose/z-multi-choose.vue';
    export default {
        components: {
            cascader,
            ldSelect
        },
        data() {
            return {
                ureportInfo: {

                },
                navbar: {
                    title: this.$t('ureport.ureport.ureportEdit'),
                    background: {
                        backgroundColor: '#001f3f',
                        backgroundImage: 'linear-gradient(45deg, rgb(28, 187, 180), rgb(141, 198, 63))'
                    }
                }
            }
        },
        onLoad(data) {
            this.ureportInfo = JSON.parse(data.ureportInfo)

        },
        methods: {
            // 保存或更新
            saveOrUpdate() {
                var url = '/ureport/ureport/insert';
                if (this.ureportInfo.ureportId) {
                    url = '/ureport/ureport/update';
                }
                request({
                    url: url,
                    method: 'post',
                    data: this.ureportInfo
                }).then(response => {
                    this.$u.route({
                        url: "/pages/ureport/ureport/ureport-list"
                    })
                })
            }
        }
    }
</script>

<style>
    .wrap {
        padding: 40rpx;
    }
</style>
